package com.project.structures.xml;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;


@XmlRootElement(name="urlrewrite")
public class UrlRewriterXML {
	
	private List<OutboundRuleXML> outboundRules;
	private List<RuleXML> rules;

	/**
	 * @return the rules
	 */
	@XmlElement(name = "rule")
	public List<RuleXML> getRules() {
		return rules;
	}


	/**
	 * @param rules the rules to set
	 */
	public void setRules(List<RuleXML> rules) {
		this.rules = rules;
	}


	/**
	 * @return the outboundRules
	 */
	@XmlElement(name = "outbound-rule")
	public List<OutboundRuleXML> getOutboundRules() {
		return outboundRules;
	}


	/**
	 * @param outboundRules the outboundRules to set
	 */
	public void setOutboundRules(List<OutboundRuleXML> outboundRules) {
		this.outboundRules = outboundRules;
	}
	
	public void addRule(RuleXML rule) {
		this.rules.add(rule);
	}
	
	public Boolean contains(String ruleLink) {
		for(RuleXML rule : this.rules) {
			if (rule.getFrom().equalsIgnoreCase(ruleLink)) {
				return true;
			}
		}
		return false;
	}
}